<template name="putawayMoveDocByItemRFListPage">
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true" backRouterName="putawayMoveDocPage">
			<block slot="content">按货品上架 - 入口</block>
		</cu-custom>
		<view class="cu-bar bg-gradual-blue search">
			<view class="search-form radius">
				<text class="cuIcon-search"></text>
				<input :adjust-position="false"  v-model="searchParam" @input="onInput"  type="text" placeholder="ASN或者客户单号" confirm-type="search" @confirm="search()"></input>
			</view>
		</view>
		<view>
			<view class="cu-card article"v-for="(item,index) in putAwayItemList" @tap="choosePutAwayItem(item)">
				<view class="cu-item shadow bg-gradual-green">
					<view class="title">
						<view class="text-cut text-center text-purple text-bold" style="font-size: 18px;">{{item.asnCode}}</view>
					</view>
					<view class="content">
						<view class="desc">
							<view class="text-gray text-sm flex">
								<view class="text-cut">
									<text class="text-white text-bold margin-left-xs" style="font-size: 15px;">[物料编码]：{{item.itemCode}}</text>
								</view> 
							</view>
							<view class="text-gray text-sm flex">
								<view class="text-cut">
									<text class="text-white text-bold margin-left-xs" style="font-size: 15px;">[物料名称]：{{item.itemName}}</text>
								</view> 
							</view>
							<view class="text-gray text-sm flex">
								<view class="text-cut">
									<text class="text-white text-bold margin-left-xs" style="font-size: 15px;">[待上架数量]：{{item.taskQty}}</text>
								</view> 
							</view>
							<view class="text-gray text-sm flex">
								<view class="text">
									<text class="text-white text-bold margin-left-xs" style="font-size: 15px;">[批属性]：【{{item.lotDisplay}}】</text>
								</view> 
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import crypto from '@/api/crypto.js'
	export default {
		data() {
			return {
				searchParam:'',
				putAwayItemList:[],
				putAwayItemUrl:'/pda/initPutAwayItemList'
			}
		},
		onLoad:function(){
			this.initPutAwayItemList();
		},
		methods: {
			initPutAwayItemList(){
				this.$http.get(this.putAwayItemUrl,{params:{warehouseId:crypto.encrypt(this.$store.getters.warehouseid),searchParam:crypto.encrypt(this.searchParam)}}).then(res=>{
				  if(res.data.success){
					  this.putAwayItemList = res.data.result;
				  }else{
					 this.$tip.error(res.data.message);
				  }
				}).catch(()=>{
					this.$tip.loaded();
				});
			},
			onInput(e){
				this.searchParam = e.target.value
			},
			choosePutAwayItem(item){
				uni.navigateTo({
					url: '/pages/wms/putawayMoveDocRFItemInputPage?item='+ encodeURIComponent(JSON.stringify(item))
				});
			},
			search(){
				this.initPutAwayItemList();
			}
		}
	}
</script>